package com.IoLiu;

import java.util.HashSet;
import java.util.Random;

public class Demo2 {
    public static void main(String[] args) {
         method();
    }
    private static void method() {
        Random ran=new Random();
        HashSet<Integer> set=new HashSet<>();
        for (int i = 0; i < 10; i++) {
            int a=ran.nextInt(11);
            if(set.add(a)){
                System.out.println(a);
            }else{
                i--;
            }

        }
    }
}
